package com.miyake.dsp.otdr;

public class NodeProperties {
	
	private Fiber fiber;
	private FiberProperties fiberProp;
//	private double wavelength;
	private double length;
	private double loss;
	private double reflectance;
	private double linLoss;
	private double linReflectance;

	public NodeProperties (Fiber fiber) {
		length = 1.0;
		this.setLoss(1.0);
		this.setReflectance(-120);
		
		this.fiber = fiber;
	}
	
	/**
	 * @return the length
	 */
	public double getLength() {
		return length;
	}
	/**
	 * @param length the length to set
	 */
	public void setLength(double length) {
		this.length = length;
	}

	/**
	 * @return the loss
	 */
	public double getLoss() {
		return loss;
	}
	/**
	 * @param loss the loss to set
	 */
	public void setLoss(double loss) {
		this.loss = loss;
		this.linLoss = Math.pow(10.0, -loss/10.0);
	}
	/**
	 * @return the reflectance
	 */
	public double getReflectance() {
		return reflectance;
	}
	/**
	 * @param reflectance the reflectance to set
	 */
	public void setReflectance(double reflectance) {
		this.reflectance = reflectance;
		linReflectance = Math.pow(10.0, reflectance/10.0);
	}


	/**
	 * @return the linLoss
	 */
	public double getLinLoss() {
		return linLoss;
	}

	/**
	 * @return the linReflectance
	 */
	public double getLinReflectance() {
		return linReflectance;
	}

	public FiberProperties getFiberProp() {
		return fiberProp;
	}

	public void setFiberProp(FiberProperties fiberProp) {
		this.fiberProp = fiberProp;
	}

	public double getWavelength() {
		return fiberProp.getWavelength();
	}

	public void setWavelength(double wavelength) {
		fiberProp = fiber.getProperties(wavelength);
	}

	public Fiber getFiber() {
		return fiber;
	}

	public void setFiber(Fiber fiber) {
		this.fiber = fiber;
	}
	
}
